package com.example.huancun.controller;

import com.example.huancun.entity.Comment;
import com.example.huancun.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;



@RestController
public class CommentController{
@Autowired
private CommentService commentService;
@GetMapping("/comment/{id}")
public Comment findComment(@PathVariable("id") Integer id){
        return commentService.findCommentById(id);
        }
@GetMapping("/comment/{id}/{content}")
public Comment updateComment(@PathVariable("id") Integer id,
                             @PathVariable("content") String content){
        return commentService.updateComment(id, content);
        }
@GetMapping("/comment/delete/{id}")
public void deleteComment(@PathVariable("id") Integer id) {
        commentService.deleteCommentById(id);
        }
        }
